<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="xwcms" uri="/WEB-INF/CMSConfig/com.xwtech.cms.tld"%>

<xwcms:get datalist="/admin/AdminUserMenu_query.xml" bean="menuBean"></xwcms:get>

<html>
	<head>
		<link href="/cring/css/admin_style.css" rel="stylesheet"
			type="text/css">
	</head>
	<body>

		<form name="frmMenu" action="/cring/jsp/admin/menu.do" method="post"
			style="display: inline" target="_parent">
			<table width="100%" border="0" align="center" cellpadding="0"
				cellspacing="0" class="table_big">
				<tr>
					<td>
						<table width="100%" border="0" align="center" cellpadding="0"
							cellspacing="0">
							<tr>
								<td width="4" height="4">
									<img src="/cring/image/admin/title_r4_c3.gif" width="4"
										height="4">
								</td>
								<td height="4">
									<img src="/cring/image/admin/title_r4_c4.jpg" width="100%"
										height="4">
								</td>
								<td width="4" height="4">
									<img src="/cring/image/admin/title_r4_c8.gif" width="4"
										height="4">
								</td>
							</tr>
						</table>

						<table width="100%" border="0" align="center" cellpadding="0"
							cellspacing="0">
							<tr>
								<td width="4" background="/cring/image/admin/title_r5_c3.jpg"
									bgcolor="#CCCCCC">
									&nbsp;
								</td>
								<td bgcolor="#EEF7FD">
									<table height="60" border="0" cellpadding="0" cellspacing="20">
										<tr>
											<td align="center">
												<input type="button" class="button_xy_normal"
													value="保&nbsp;存" onclick="insert();">
											</td>
										</tr>
									</table>
									<table width="100%" border="0" align="center" cellpadding="0"
										cellspacing="0">
										<tr>
											<td height="12" valign="top">
												<table width="100%" border="0" align="center"
													cellpadding="0" cellspacing="1">
													<tr>
														<td height="5"
															background="../../../cring/image/admin/title_r10_c5.jpg"></td>
													</tr>
												</table>
											</td>
										</tr>
									</table>
									<table width="98%" border="0" align="center" cellpadding="0"
										cellspacing="0">
										<tr>
											<td height="12" valign="top">

												<table width="97%" border="0" cellpadding="0"
													cellspacing="1" class="table_normal">
													<tr>
														<td width="150" height="36" class="td_item_right">
															所属菜单:
														</td>
														<td class="td_normal_left">
															<xwcms:write property="submenu_name" name="menuBean" />
														</td>
													</tr>
													<tr>
														<td width="150" height="36" class="td_item_right">
															菜单名:
														</td>
														<td class="td_normal_left">
															<input id="submenu_name" name="submenu_name" type="text"
																class="input_normal"
																value="" size="30">
															<font color="red">*</font>
														</td>
													</tr>
													<tr>
														<td width="150" height="36" class="td_item_right">
															URL:
														</td>
														<td class="td_normal_left">
															<input name="url_value" type="text" class="input_normal"
																value="" size="30">
														</td>
													</tr>
													<tr>
														<td width="150" height="36" class="td_item_right">
															排序号:
														</td>
														<td class="td_normal_left">
															<input name="submenu_sort" type="text"
																class="input_normal"
																value="" size="30">
															<font color="red">*</font>
														</td>
													</tr>
												</table>

											</td>
										</tr>
									</table>

									<table width="100%" border="0" align="center" cellpadding="0"
										cellspacing="0">
										<tr>
											<td width="4" height="4">
												<img src="/cring/image/admin/title_r10_c3.gif" width="4"
													height="4">
											</td>
											<td height="4">
												<img src="/cring/image/admin/title_r12_c4.jpg" width="100%"
													height="4">
											</td>
											<td width="4" height="4">
												<img src="/cring/image/admin/title_r10_c8.gif" width="4"
													height="4">
											</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>

			<input type="hidden" name="method" value="insertMenu">
			<input type="hidden" name="_success" value="0">
			<input type="hidden" name="_failure" value="0">

			<input type="hidden" name="_url" value="/cring/jsp/admin/bg_menu_index.jsp?submenu_id=<xwcms:write property="submenu_id" name="menuBean"/>">

			<input type="hidden" name="_sql" value="/admin/AdminUserRole_insert.xml,/admin/AdminUserUrl_insert.xml,/admin/AdminUserMenu_insert.xml,/admin/AdminUserRoleMenu_insert.xml">

			<input type="hidden" name="role_id" value="">
			<input type="hidden" name="url_name" value="">
			<input type="hidden" name="url_desc" value="">
			<input type="hidden" name="menu_id" value="<xwcms:write property="submenu_id" name="menuBean"/>">
		</form>
	</body>
</html>

<script language=javascript src="/cring/js/common.js"></script>
<script type="text/javascript">
	function insert() {
		
		if(document.all.submenu_name.value.trim() == "") {
			alert("菜单名称不能为空！");
			document.all.submenu_name.focus();
			return;
		}
		
		if("" == document.all.submenu_sort.value.trim() 
				|| !isNatrualNum(document.all.submenu_sort.value)) {
			alert("排序号不能为空且只能为自然数！");
			document.all.submenu_sort.focus();
			return;
		}

		document.all.url_name.value = document.all.submenu_name.value;
		document.all.url_desc.value = document.all.submenu_name.value;
		
		
		if (window.confirm("是否增加？"))
			document.frmMenu.submit();		
		
	}
</script>
